<?php if ($winner->num_rows() > 0) : ?>
<ul>
    <?php foreach($winner->result() as $value ) : ?>
        <li class="flex">
            <div class="lottery-bottom flex-1">
                <h4 class="am-text-truncate"><?php echo $value->prize_name; ?></h4>
                <p><?php echo $value->created_at; ?></p>
            </div>
            <div class="lottery-collar">
                <?php if ($value->prize_type == 4) : ?>
                    <?php if ( $value->effective_date >= date('Y-m-d H:i:s') ): ?>
                        <a href="javascript:;" class="lottery-receive special-prize <?php echo ($value->status == 3) ? 'lottery-receive-success' : ''; ?>" data-link="<?php echo $value->links ? $value->links : 'javascript:;'; ?>"
                        data-img="<?php echo $this->config->show_image_url($value->image); ?>"
                        data-state="<?php echo $value->status; ?>"
                        data-status="<?php
                                switch ($value->status) {
                                    case 1:
                                        echo '确认领取奖品';
                                        break;
                                    case 2:
                                        echo '请到现场领奖';
                                        break;
                                    case 3:
                                        echo '颁奖成功！';
                                        break;
                                    default:
                                        break;
                                }  ?>"
                        data-name="<?php echo $value->prize_name; ?>" data-id="<?php echo $value->id; ?>" >
                            <i class="iconfont">&#xe627;</i>
                            <p><?php
                                    switch ($value->status) {
                                        case 1:
                                            echo '点我领奖';
                                            break;
                                        case 2:
                                            echo '待<br/>颁奖';
                                            break;
                                        case 3:
                                            echo '颁奖成功';
                                            break;
                                        default:
                                            break;
                                    }
                                ?>
                           </p>
                        </a>
                    <?php else : ?>
                        <a href="javascript:;" >
                            <i class="iconfont">&#xe627;</i>
                            <p>领</p>
                            <span class="invalid">已失效</span>
                        </a>
                    <?php endif; ?>
                <?php else : ?>
                    <?php if ($value->status == 1) : ?>
                        <?php if ( $value->effective_date >= date('Y-m-d H:i:s') ): ?>
                            <a href="<?php echo ($value->prize_type == 3) ? site_url('home/winners/detail/'. $value->id) : 'javascript:;'; ?>" 
                            class="lottery-receive <?php if ($value->prize_type == 1) { echo 'accept-prize'; } elseif ($value->prize_type == 2) {echo 'accept-virtual-prize';} elseif($value->prize_type == 3) {echo 'bz-currency';} ?>"
                            data-link="<?php echo $value->links ? $value->links : 'javascript:;'; ?>"
                            data-img="<?php echo $this->config->show_image_url($value->image); ?>"
                            data-name="<?php echo $value->prize_name; ?>" data-id="<?php echo $value->id; ?>" >
                                <i class="iconfont">&#xe627;</i>
                                <p>点我领奖</p>
                            </a>
                        <?php else : ?>
                            <a href="javascript:;" >
                                <i class="iconfont">&#xe627;</i>
                                <p>领</p>
                                <span class="invalid">已失效</span>
                            </a>
                        <?php endif; ?>
                    <?php else : ?>
                        <a href="<?php echo site_url('home/winners/detail/'.$value->id); ?>" class="lottery-receive">
                            <i class="iconfont">&#xe627;</i>
                            <p class="lottery-already">已领</p>
                            <img src="/skins/home/images/look.png">
                        </a>
                    <?php endif; ?>
                <?php endif; ?>
            </div>
        </li>
    <?php endforeach ?>
</ul>
<?php else : ?>
    <div class="icon-none">
        <i class="iconfont">&#xe603;</i>
        <p>还没有中奖记录</p>
    </div>
<?php endif; ?>